﻿'© 2004 - 2008 ActiveModules, Inc. All Rights Reserved
Namespace DotNetNuke.Modules.ActiveForums
    Partial Public Class admin_filters_new
        Inherits ActiveAdminBase
#Region "Event Handlers"
        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
            agFilters.ColDelimiter = "||"
        End Sub

        Private Sub agFilters_Callback(ByVal sender As Object, ByVal e As Modules.ActiveForums.Controls.CallBackEventArgs) Handles agFilters.Callback
            Try
                If Not e.Parameters(4) = "" Then
                    Dim sAction As String = e.Parameters(4).Split(CChar(":"))(0)
                    Dim FilterId As Integer = CInt(e.Parameters(4).Split(CChar(":"))(1))
                    Select Case sAction.ToUpper
                        Case "DELETE"
                            If IsNumeric(FilterId) Then
                                DataProvider.Instance.Filters_Delete(PortalId, ModuleId, FilterId)
                            End If
                        Case "DEFAULTS"
                            DataProvider.Instance.Filters_DeleteByModuleId(PortalId, ModuleId)
                            Utilities.ImportFilter(PortalId, ModuleId)
                    End Select

                End If
                Dim PageIndex As Integer = CInt(e.Parameters(0))
                Dim PageSize As Integer = CInt(e.Parameters(1))
                Dim SortColumn As String = e.Parameters(2).ToString
                Dim Sort As String = e.Parameters(3).ToString
                agFilters.Datasource = DataProvider.Instance.Filters_List(PortalId, ModuleId, PageIndex, PageSize, Sort, SortColumn)
                agFilters.Refresh(e.Output)
            Catch ex As Exception

            End Try

        End Sub

        Private Sub agFilters_ItemBound(ByVal sender As Object, ByVal e As Modules.ActiveForums.Controls.ItemBoundEventArgs) Handles agFilters.ItemBound
            e.Item(1) = Server.HtmlEncode(e.Item(1).ToString)
            e.Item(2) = Server.HtmlEncode(e.Item(2).ToString)
            e.Item(4) = "<img src=""" & Page.ResolveUrl("~/desktopmodules/activeforums/images/delete16.png") & """ alt=""" & GetSharedResource("[RESX:Delete]") & """ height=""16"" width=""16"" />"
        End Sub
#End Region

    End Class
End Namespace
